home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 14 / CU Amiga Magazine's Super CD-ROM 14 (1997)(EMAP Images)(GB)(Track 1 of 3)[!][issue 1997-09].iso / CUCD / Programming / IEditor / Generators / E / fonts.c < prev    next >
Encoding:
C/C++ Source or Header  |  1997-06-17  |  2.1 KB  |  90 lines

  1. /// Includes
  2. #define INTUI_V36_NAMES_ONLY
  3.  
  4. #include <exec/types.h>                 // exec
  5. #include <exec/lists.h>
  6. #include <exec/nodes.h>
  7. #include <dos/dos.h>                    // dos
  8. #include <clib/exec_protos.h>           // protos
  9. #include <clib/dos_protos.h>
  10. #include <pragmas/exec_pragmas.h>       // pragmas
  11. #include <pragmas/dos_pragmas.h>
  12.  
  13. #include <string.h>
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <ctype.h>
  17.  
  18. #include "DEV_IE:Generators/defs.h"
  19. #include "DEV_IE:Include/IEditor.h"
  20.  
  21. #include "Protos.h"
  22. ///
  23.  
  24.  
  25. /// WriteFontPtrs
  26. void WriteFontPtrs( struct GenFiles *Files, struct IE_Data *IE )
  27. {
  28.     struct TxtAttrNode *fnt;
  29.  
  30.     if( IE->SrcFlags & OPENDISKFONT ) {
  31.     for( fnt = IE->FntLst.mlh_Head; fnt->txa_Next; fnt = fnt->txa_Next ) {
  32.         if( fnt->txa_Flags & FPB_DISKFONT ) {
  33.         TEXT    Label[60];
  34.  
  35.         StrToLower( fnt->txa_Label, Label );
  36.  
  37.         FPrintf( Files->Std,  "DEF %sfont=NIL:PTR TO textfont\n", Label );
  38.         }
  39.     }
  40.     }
  41. }
  42. ///
  43. /// WriteOpenFonts
  44. void WriteOpenFonts( struct GenFiles *Files, struct IE_Data *IE )
  45. {
  46.     struct TxtAttrNode *fnt;
  47.     BOOL                ok = FALSE;
  48.  
  49.     if( IE->SrcFlags & OPENDISKFONT ) {
  50.  
  51.     for( fnt = IE->FntLst.mlh_Head; fnt->txa_Next; fnt = fnt->txa_Next ) {
  52.         if( fnt->txa_Flags & FPB_DISKFONT )
  53.         ok = TRUE;
  54.     }
  55.  
  56.     if( ok ) {
  57.  
  58.         FPuts( Files->Std,  "\nBOOL OpenDiskFonts( void )\n"
  59.                 "{\n" );
  60.  
  61.         for( fnt = IE->FntLst.mlh_Head; fnt->txa_Next; fnt = fnt->txa_Next ) {
  62.         if( fnt->txa_Flags & FPB_DISKFONT )
  63.             FPrintf( Files->Std, "\tif (!( %sFont = OpenDiskFont( &%s )))\n"
  64.                      "\t\treturn( FALSE );\n",
  65.                  fnt->txa_Label, fnt->txa_Label );
  66.         }
  67.  
  68.         FPuts( Files->Std, "\treturn( TRUE );\n"
  69.                    "}\n\n"
  70.                    "void CloseDiskFonts( void )\n"
  71.                    "{\n" );
  72.  
  73.         for( fnt = IE->FntLst.mlh_Head; fnt->txa_Next; fnt = fnt->txa_Next ) {
  74.         if( fnt->txa_Flags & FPB_DISKFONT ) {
  75.             FPrintf( Files->Std, "\tif ( %sFont ) {\n"
  76.                      "\t\tCloseFont( %sFont );\n"
  77.                      "\t\t%sFont = NULL;\n"
  78.                      "\t}\n",
  79.                  fnt->txa_Label, fnt->txa_Label, fnt->txa_Label );
  80.         }
  81.         }
  82.  
  83.         FPuts( Files->Std, "}\n" );
  84.     }
  85.  
  86.     }
  87. }
  88. ///
  89.  
  90.